home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / CIncludes / SystemNotification.h < prev    next >
C/C++ Source or Header  |  1996-05-01  |  4KB  |  152 lines

  1. /*
  2.      File:        SystemNotification.h
  3.  
  4.      Contains:    System Notification Service Interfaces.
  5.  
  6.      Version:    Technology:    System 8
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. */
  18. #ifndef __SYSTEMNOTIFICATION__
  19. #define __SYSTEMNOTIFICATION__
  20.  
  21. #ifndef __KERNEL__
  22. #include <Kernel.h>
  23. #endif
  24. #ifndef __FILEMANAGERTYPES__
  25. #include <FileManagerTypes.h>
  26. #endif
  27. #ifndef __NAMEREGISTRY__
  28. #include <NameRegistry.h>
  29. #endif
  30.  
  31. #ifdef __cplusplus
  32. extern "C" {
  33. #endif
  34.  
  35. #if PRAGMA_IMPORT_SUPPORTED
  36. #pragma import on
  37. #endif
  38.  
  39. #if PRAGMA_ALIGN_SUPPORTED
  40. #pragma options align=power
  41. /* the following contents can only be used by compilers that support PowerPC struct alignment */
  42.  
  43. #if FOR_SYSTEM8_PREEMPTIVE
  44. /*
  45.  * basic notification data structures and constants
  46. */
  47.  
  48. enum {
  49.     kSNSMatchAnyService            = '****',
  50.     kSNSMatchAnyKind            = '****'
  51. };
  52.  
  53. typedef OSType SNSService;
  54. typedef OSType SNSKind;
  55. union SNSSubjectVariant {
  56.     char                             genericSubject[256];
  57.     ObjectID                         nsObject;
  58.     FSObjectPersistentReference     fsPersistence;
  59.     FSEventObjectSubject             fsObject;
  60.     FSEventObjectPropertySubject     fsObjectProperty;
  61.     RegEntryRef                     nameRegistryEntry;
  62. };
  63. typedef union SNSSubjectVariant SNSSubjectVariant;
  64.  
  65. typedef SNSSubjectVariant *SNSSubjectVariantPtr;
  66. struct SNSSubject {
  67.     ByteCount                         subjectLength;
  68.     SNSSubjectVariant                 subject;
  69. };
  70. typedef struct SNSSubject SNSSubject;
  71.  
  72. typedef SNSSubject *SNSSubjectPtr;
  73. struct SNSNotificationHeader {
  74.     SNSService                         service;
  75.     SNSKind                         kind;
  76.     SNSSubject                         subject;
  77.     void *                            subscriberRefCon;
  78.     ByteCount                         infoLength;
  79. };
  80. typedef struct SNSNotificationHeader SNSNotificationHeader;
  81.  
  82. typedef SNSNotificationHeader *SNSNotificationHeaderPtr;
  83. struct SNSNotification {
  84.     SNSNotificationHeader             header;
  85.     unsigned char                     info[1];
  86. };
  87. typedef struct SNSNotification SNSNotification;
  88.  
  89. typedef SNSNotification *SNSNotificationPtr;
  90. /*
  91.  * producer data structures and constants
  92. */
  93.  
  94. enum {
  95.     kSNSFireAndForgetNotification = 0,
  96.     kSNSRequireAllConsumersSucceed = 0x00000001,
  97.     kSNSRequireOneConsumerSucceed = 0x00000002
  98. };
  99.  
  100. typedef OptionBits SNSProduceOptions;
  101. typedef ObjectID SNSDistributorID;
  102. /*
  103.  * consumer data structures and constants
  104. */
  105. typedef ObjectID SNSConsumerID;
  106. typedef OSType SNSConsumerName;
  107. /*
  108.  * producer interface
  109. */
  110. extern OSStatus SNSFindDistributor(SNSService service, SNSKind kind, Boolean createDistributor, SNSDistributorID *distributor);
  111.  
  112. extern OSStatus SNSProduce(SNSDistributorID distributor, void *notification, ByteCount notificationLength, void *subject, ByteCount subjectLength, SNSProduceOptions options);
  113.  
  114. extern OSStatus SNSProduceAsync(SNSDistributorID distributor, void *notification, ByteCount notificationLength, void *subject, ByteCount subjectLength, SNSProduceOptions options, KernelNotificationPtr completion);
  115.  
  116. /*
  117.  * consumer and subscription interface
  118. */
  119. extern OSStatus SNSCreateConsumer(SNSConsumerName name, ItemCount maxPending, SNSConsumerID *consumer);
  120.  
  121. extern OSStatus SNSDeleteConsumer(SNSConsumerID consumer);
  122.  
  123. extern OSStatus SNSSubscribe(SNSConsumerID consumer, SNSService service, SNSKind kind, void *subject, ByteCount subjectLength, void *refCon);
  124.  
  125. extern OSStatus SNSUnsubscribe(SNSConsumerID consumer, SNSService service, SNSKind kind, void *subject, ByteCount subjectLength);
  126.  
  127. extern OSStatus SNSHold(SNSConsumerID consumer, SNSService service, SNSKind kind, void *subject, ByteCount subjectLength);
  128.  
  129. extern OSStatus SNSUnhold(SNSConsumerID consumer, SNSService service, SNSKind kind, void *subject, ByteCount subjectLength);
  130.  
  131. extern OSStatus SNSFlush(SNSConsumerID consumer, SNSService service, SNSKind kind, void *subject, ByteCount subjectLength);
  132.  
  133. extern OSStatus SNSConsume(SNSConsumerID consumer, SNSNotificationPtr notification, ByteCount maxSize);
  134.  
  135. extern OSStatus SNSConsumeAsync(SNSConsumerID consumer, SNSNotificationPtr notification, ByteCount maxSize, KernelNotificationPtr completion);
  136.  
  137. #endif
  138.  
  139. #pragma options align=reset
  140. #endif /* PRAGMA_ALIGN_SUPPORTED */
  141.  
  142. #if PRAGMA_IMPORT_SUPPORTED
  143. #pragma import off
  144. #endif
  145.  
  146. #ifdef __cplusplus
  147. }
  148. #endif
  149.  
  150. #endif /* __SYSTEMNOTIFICATION__ */
  151.  
  152.